{# 如果超过学习有效期最后期限,或者现课程购买开放但是课程加入有效期过期视为课程过期 #}
{% set isOvertime = ((course.expiryEndDate and course.expiryEndDate < 'now'|date('U')) or (course.buyable and course.buyExpiryTime and course.buyExpiryTime < 'now'|date('U'))) %}
{% set canBuy = can_buy_course(course) %}
<tmp hide-if="{isItemDisplayedAsUnpublished}">
  {% if member %}
    <a hide-if="{isTaskLocked}" class="title" href="{{ path('course_task_show',{courseId:course.id, id: '{taskId}'}) }}">
      {% include 'course/task-list/parts/list-li-title-template.html.twig' %}
    </a>

    <span display-if="{isTaskLocked}" class="title">
      {% include 'course/task-list/parts/list-li-title-template.html.twig' %}
    </span>
  {% elseif canBuy or (not isOvertime and course.vipLevelId > 0) %}{# 不是课程学员，并且课程允许购买，此处即使不是学员，也可以显示预览按钮，原因是控制器会报错，然后弹出登陆框提醒客户登陆 #}
    <a display-if="{isTaskShowModal}"  class="title" href="#modal" data-toggle="modal"
        data-url="{{ path('course_task_preview',{courseId:course.id, id: '{taskId}'}) }}"
        style="margin-top:-6px">{% include 'course/task-list/parts/list-li-title-template.html.twig' %}</a>
    {% if app.user %}
      <a hide-if="{isTaskShowModal}" class="title {% if course.parentId|default(0) == 0 %}js-lesson-item-notify{% endif %}" href="javascript:;"
         data-notify-message="{{ 'course.task.notify_message.join_and_buy'|trans }}"
         style="margin-top:-6px">{% include 'course/task-list/parts/list-li-title-template.html.twig' %}</a>
    {% else %}
      <a hide-if="{isTaskShowModal}"  class="title" href="#modal" data-toggle="modal"
         data-url="{{ path('login_ajax') }}"
         style="margin-top:-6px">{% include 'course/task-list/parts/list-li-title-template.html.twig' %}</a>
    {% endif %}

  {% else %}{# 过期了,不管登陆与否，只要不包含预览和免费，应该提示'该课程已限制加入，请联系客服' #}
    <a display-if="{isTaskShowModal}"  class="title" href="#modal" data-toggle="modal"
       data-url="{{ path('course_task_preview',{courseId:course.id, id: '{taskId}'}) }}"
       style="margin-top:-6px">{% include 'course/task-list/parts/list-li-title-template.html.twig' %}</a>
    <a hide-if="{isTaskShowModal}" class="title {% if course.parentId|default(0) == 0 %}js-lesson-item-notify{% endif %}" href="javascript:;"
       data-notify-message="{{ 'course.task.notify_message.join_limit'|trans }}"
       style="margin-top:-6px">{% include 'course/task-list/parts/list-li-title-template.html.twig' %}</a>
  {% endif %}

  {% include 'course/task-list/parts/task-length-template.html.twig' %}
  <span class="right-menu mouse-enter">
    {% if not member and courseSet.status | default('published') == 'published' %}
      <tmp display-if="{isTaskFree}">
        <a class="btn btn-primary" href="#modal" data-toggle="modal"
            data-url="{{ path('course_task_preview',{courseId:course.id, id: '{taskId}'}) }}"
            style="margin-top:-6px">{{ 'course.catalogue.task.preview_btn'|trans }}</a>
      </tmp>
      <tmp display-if="{isTaskTryLookable}">
        <a class="btn btn-warning" href="#modal" data-toggle="modal"
            data-url="{{ path('course_task_preview',{courseId:course.id, id: '{taskId}'}) }}"
            style="margin-top:-6px">{{ 'course.catalogue.task.try_look_btn'|trans }}</a>
      </tmp>
    {% endif %}
  </span>
</tmp>

<tmp display-if="{isItemDisplayedAsUnpublished}">
  <span class="title">
    {% include 'course/task-list/parts/list-li-title-template.html.twig' %}
  </span>
  <span class="right-menu color-gray">
    {{ 'course.catalogue.task_status.looking_forward'|trans }}
  </span>
</tmp>